package summative;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class DrawListener implements MouseListener
{
	int clickCounter = 1;
	int xInit;
	int yInit;
	int xFin;
	int yFin;
	VectorList list;
	
	public DrawListener(VectorList list)
	{
		this.list = list;
	}

	public void mouseClicked(MouseEvent e) 
	{
		if(clickCounter == 1)
		{
			xInit = e.getX();
			yInit = e.getY();
			clickCounter++;
		}
		else if(clickCounter == 2)
		{
			xFin = e.getX();
			yFin = e.getY();
			clickCounter=1;
			list.addVector(xInit, yInit, xFin, yFin, true);
		}
	}

	public void mouseEntered(MouseEvent e) 
	{
		
	}

	public void mouseExited(MouseEvent e) 
	{
		
	}

	public void mousePressed(MouseEvent e) 
	{
		
	}

	public void mouseReleased(MouseEvent e) 
	{		
	}
}
